package cn.wolfcode.enums;

import lombok.Getter;

@Getter
public enum AppointmentEnums {
    PEND("待确认",0),
    PERFORM("履行中",1),
    CONSUME("消费中",2),
    FINISH("归档",3),
    FAILURE("废弃",4);
    private String name;
    private Integer value;
     AppointmentEnums(String name, Integer value){
         this.name=name;
         this.value=value;
    }

    public static String findName(Integer value){
         //得所有的枚举对象
        AppointmentEnums[] values = AppointmentEnums.values();
        for (AppointmentEnums appointmentEnums:values){
            //遍历枚举对象,对比value将符合的name返回
            if (appointmentEnums.value.equals(value)){
                return appointmentEnums.name;
            }
        }
        return null;
    }
}
